{extend name="layout/main" /}

{block name="header"}

{/block}

{block name="content"}
<section class="panel">
    <header class="panel-heading">
        <h4>订单列表-{$Request.get.type}{if $Request.get.types == '1'} 待发货 {/if}{if $Request.get.types == '2'} 待收货 {/if}{if $Request.get.types == '3'} 已完成 {/if}{if $Request.get.types == '0'} 待付款 {/if}</h4>
    </header>
    <div class="panel-body" style="padding-bottom: 50px">
        <form class="form-horizontal" action="{:url('goodsorders/index')}">
            <div class="form-group">

                <div class="col-xs-2 no-pd-r">
                    <select name="type" id="type" class="form-control">
                        <option {if $Request.get.type == 'nick_name'} selected {/if}   value="mobile">买家账号</option>
                        <option {if $Request.get.type == 'number'} selected {/if}   value="number">订单编号</option>
                    </select>
                </div>
                <div class="col-xs-3">
                    <input type="text" value="" name="search" id="search" class="form-control"
                           placeholder="请输入搜索内容">
                </div>
             <!--   <div class="col-xs-1 no-pd-r">
                    <select name="types" id="types" class="form-control">
                        <option value="-1">全部类型</option>
                        <option {if $Request.get.types == '1'} selected {/if} value="1">待发货</option>
                        <option {if $Request.get.types == '2'} selected {/if} value="2">待收货</option>
                        <option {if $Request.get.types == '3'} selected {/if} value="3">已完成</option>
                        <option {if $Request.get.types == '9'} selected {/if} value="0">待付款</option>
                    </select>
                </div>-->
                <button type="submit" class="btn btn-color">搜索</button>
                <a type="button" onclick="xlsx()" class="btn btn-info">导出</a>
            </div>
        </form>
        <table class="table table-bordered table-striped no-margin">
            <thead>
            <tr>
                <th class="text-center">订单ID</th>
                <th class="text-center">会员信息</th>
                <th class="text-center">订单编号</th>
                <th class="text-center">类型</th>
                <th class="text-center">收货地址</th>
                <th class="text-center">付款方式</th>
                <th class="text-center">商品信息</th>
                <th class="text-center">总价</th>
                <th class="text-center">时间</th>
                <th class="text-center">状态</th>
                <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            {if !empty($lists)}

            {foreach $lists as $g}
            <tr>
                <td class="text-center" >
                    {$g.id}
                </td>
                <td class="text-center" >
                    会员id：{$g.uid}<br>
                    会员昵称：{$g.nick_name}<br>
                    会员手机号：{$g.mobile}<br>
                </td>
                <td class="text-center">
                    {$g.ordersn}
                </td>
                <td class="text-center">
                    {$shoptype[$g.shoptype]}
                </td>
                <td class="text-center">
                    收货人：{$g.address.name}<br>
                    手机号：{$g.address.mobile}<br>
                    地址：{$g.address.province} {$g.address.city} {$g.address.area}<br>
                    详细地址：{$g.address.address}<br>
                </td>
                <td class="text-center">
                    {if $g.paytype>0}
                    {$g->pay[$g.paytype]}
                    {else}
                    未付款
                    {/if}
                </td>
                <td class="text-center">
                    <table class="table table-bordered table-striped no-margin">
                        {foreach $g.goods as $og}
                        <tr>

                            <td class="text-center" >
                                <img src="{$og.img}" style="width: 100px;" alt="">

                            </td>
                            <td>
                                商品： {$og.title}<br>

                                价格：{$og.price}<br>

                                购买数量：{$og.number}<br>
                                小计：{$og.alltotal}<br>
                            </td>
                        </tr>
                        {/foreach}
                    </table>
                </td>
                <td class="text-center" >
                    {$g.total}
                </td>
                <td class="text-center" >
                    下单时间：{$g.createtime|date="Y-m-d H:i:s"}<br>
                    {if $g.sendtime > 0}
                    发货时间：{$g.sendtime|date="Y-m-d H:i:s"}<br>
                    {/if}
                    {if $g.finishtime > 0}
                    完成时间：{$g.finishtime|date="Y-m-d H:i:s"}<br>
                    {/if}
                </td>
                <td class="text-center" >
                    {$g->stata[$g.status]}
                </td>
                <td class="text-center" >
                    <a href="{:url('goodsorders/orderdetail',['id'=>$g->id])}" class="btn btn-xs btn-success">订单详细信息</a>

                    <!-- <a data-url="{:url('shopgoods/delcate',['id'=>$g->id])}" onclick="main.ajaxDelete(this)" data-msg="确定要删除商品吗？" class="btn btn-xs btn-danger">删除</a> -->
                </td>
            </tr>
            {/foreach}
            {else /}
            <tr class="text-center">
                <td colspan="3">暂无数据</td>
            </tr>
            {/if}
            </tbody>
        </table>
        <div class="page">
            {:htmlspecialchars_decode($lists->render())}
        </div>
    </div>
</section>
{/block}


{block name="footer"}
<script>
    function showContent(e){
        $.dialog({
            title: '商品信息',
            content: $(e).attr('data-content')
        });
    }
    function xlsx(){
        var str = '?type='+$('#type option:selected').val();
        if($('#search').val() != ''){
            str+='&search='+$('#search').val()
        }
        if($('#types option:selected').val() != -1){
            str+='&types='+$('#types').val()
        }
        console.log("{:url('admin/Excelexport/orderList')}"+str);
        window.location.href = "{:url('admin/Excelexport/orderList')}"+str;
    }
</script>
{/block}